﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Warehouse.DataAccess
{
    public partial class ReceiptDetail : CustomeEntity<ReceiptDetail>
    {
        protected override System.Linq.Expressions.Expression<Func<ReceiptDetail, bool>> GetPredicate()
        {
            return p => p.ID == this.ID;
        }

        public static ReceiptDetail[] GetReceiptDetailsBySalesBillID(Guid salesBillId)
        {
            using (WarehouseClassesDataContext context = new WarehouseClassesDataContext())
            {
                return (from t in context.ReceiptDetail where t.BillID == (from p in context.ReceiptBill where p.SalesBillID == salesBillId select p.ID).SingleOrDefault() select t).ToArray();
            }
        }
    }
}
